import { getData, postData, deleteData } from '@/api/common/index';

const baseMatchmakerInfo = '/api/matchmaker-info';

const MatchmakerInfoUrl = {
	page: '/page',
	url: '',
	addInfo: '/addInfo',
	exportInfo: '/export',
};

export function getMatchmakerInfoPage(
	params: any,
	pageNo: number | null | undefined,
	pageSize: number | null | undefined,
): Promise<any> {
	let url =
		baseMatchmakerInfo +
		MatchmakerInfoUrl.page +
		'?pageNum=' +
		(pageNo ? pageNo : 1) +
		'&pageSize=' +
		(pageSize ? pageSize : 10);
	return postData(url, params);
}

export function getMatchmakerInfoDetail(id: number): Promise<any> {
	return getData(baseMatchmakerInfo + MatchmakerInfoUrl.url + '?id=' + id);
}

export function deleteMatchmakerInfo(ids: string): Promise<any> {
	return deleteData(baseMatchmakerInfo + MatchmakerInfoUrl.url + '?ids=' + ids);
}

export function addOrEditMatchmakerInfo(
	method: string,
	params: any,
): Promise<any> {
	console.log(method);
	return postData(baseMatchmakerInfo + MatchmakerInfoUrl.addInfo, params);
}

export function exportMatchmakerInfo(params: any, response: any): Promise<any> {
	const url = baseMatchmakerInfo + MatchmakerInfoUrl.exportInfo;
	return postData(url, params, response);
}
